<template>
	<view class="seetingBox">
		<uniNavBar left-icon="back" backgroundColor="#f8f8f8" @clickLeft='goBack'></uniNavBar>
		<u-cell-group>
			<navigator url="/pages/web-view/web-view?link=https://www.baidu.com/" open-type="navigate">
				<u-cell-item bg-color="#f8f8f8" title="隐私政策"></u-cell-item>
			</navigator>
			<navigator url="/pages/web-view/web-view?link=https://zhidao.baidu.com/" open-type="navigate">
				<u-cell-item bg-color="#f8f8f8" title="用户协议"></u-cell-item>
			</navigator>
		</u-cell-group>
		<button class="logout" type="warn" style="width: 90%;" @click="doLogout">退出登录</button>
	</view>
</template>

<script>
	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	import { mapActions } from 'vuex'
	export default {
		data() {
			return {
				
			}
		},
		components: {uniNavBar},
		methods:{
			...mapActions(['userLogoutAction']),
			doLogout () {
				uni.showModal({
					title: '确定要退出?',
					success: () => {
						// 清除vuex存储内容
						this.userLogoutAction()
						// 退出后,触发index页面的内容的清除
						uni.$emit('userIndexData')
						// 退出后,触发mine页面的内容的清除
						uni.$emit('meUserLogout')
						// 跳转到index页面
						uni.switchTab({
							url:'/pages/index/index'
						})
					}
				})
			},
			goBack() {
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.seetingBox{
	background-color: #f8f8f8;
	height: 100vh;
	.logout{
		position: absolute;
		left: 5%;
		bottom: 80upx;
	}
}
</style>
